package com.google.code.irouter.servlet;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

public final class Portal extends HttpServlet {

	private static final long serialVersionUID = -5546119560501036905L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws IOException {
		UserService userService = UserServiceFactory.getUserService();

		String thisURL = request.getRequestURI();
		if (request.getUserPrincipal() != null) {
			response.sendRedirect("/Dashboard.html");
		} else {
			response.sendRedirect(userService.createLoginURL(thisURL));
		}
	}
}
